[Json] Support FixedSizeList in json decoder - #9715
Conversation
58a95fc to
9ed71fc
Compare
Jefffrey
left a comment
There was a problem hiding this comment.
There's a fun little degenerate test case here:
#[test]
fn test_fixed_size_list_zero_size() {
let buf = r#"
{"a": []}
{"a": null}
{"a": []}
"#;
let field = Field::new_list_field(DataType::Int32, true);
let schema = Arc::new(Schema::new(vec![Field::new(
"a",
DataType::FixedSizeList(Arc::new(field), 0),
false,
)]));
let batches = do_read(buf, 1024, false, false, schema);
assert_eq!(batches.len(), 1);
let col = batches[0].column(0).as_fixed_size_list();
assert_eq!(col.len(), 3);
assert_eq!(col.value_length(), 0);
let values = col.values().as_primitive::<Int32Type>();
assert!(values.values().is_empty());
}It seems to panic within struct array decoding. Could be worth exploring in this PR if there is capacity, though considering this PR is adding a new feature I wouldn't block it on this case.
|
|
||
| let mut nulls = self | ||
| .is_nullable | ||
| .then(|| BooleanBufferBuilder::new(pos.len())); |
There was a problem hiding this comment.
Is it worth considering using NullBufferBuilder here instead?
There was a problem hiding this comment.
Filed a ticket to track
Filed a ticket to track |
|
Thank you @liamzwbao and @Jefffrey |
|
Thank you ! I was trying to finalize the release content and keep things moving. |
# Which issue does this PR close? <!-- We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. --> - Closes apache#9714. # Rationale for this change <!-- Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed. Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes. --> # What changes are included in this PR? <!-- There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR. --> Implement decoder for FixedSizeList # Are these changes tested? <!-- We typically require tests for all PRs in order to: 1. Prevent the code from being accidentally broken by subsequent changes 2. Serve as another way to document the expected behavior of the code If tests are not included in your PR, please explain why (for example, are they covered by existing tests)? --> Yes # Are there any user-facing changes? <!-- If there are user-facing changes then we may require documentation to be updated before approving the PR. If there are any breaking changes to public APIs, please call them out. --> New decoding type supported
Which issue does this PR close?
FixedSizeListin arrow-json reader #9714.Rationale for this change
What changes are included in this PR?
Implement decoder for FixedSizeList
Are these changes tested?
Yes
Are there any user-facing changes?
New decoding type supported